home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 September
/
Chip_2004-09_cd1.bin
/
program
/
delphi
/
download
/
nastroje
/
97.mpth_10[1].exe
/
{app}
/
scripts
/
Split File.mps
< prev
next >
Wrap
Text File
|
2003-08-24
|
1KB
|
49 lines
number_radix = 16
number_prefix = ''
number_suffix = ''
= split a file into different pieces
option globalvars, 1
var bytesperpart dword, fname text, nameloop word
var max dword, start dword, ende dword, curfn text, filein file, filedat file, filetemp file
var data text sum dword blocks dword rest dword fsize dword
@@start
bytesperpart = dword(input("Split file","Bytes per part", '65536'))
fname = asksavefilename("Split file: Chose filename prefix"):= get part name (apppend .01, .02...)
filedat = fileopen(fname+'.dat','c')
filein = fileopen('::current')
fsize = filesize(filein)
nameloop = 1
sum = filesize(filein)
blocks = sum / bytesperpart
rest = sum mod bytesperpart
loop writeblockfile blocks
if rest != 0
bytesperpart = rest
call writeblockfile
endif
fileclose filedat
fileclose filein
showprogress 100
end
@@writeblockfile
fileread filein data bytesperpart
showprogress fsize, filepos(filein)
curfn=fname+'.'+text(nameloop)
filetemp = fileopen(curfn, 'c')
filewrite filetemp data
fileclose filetemp
filewrite filedat (ExtractName(curfn) + "\n")
inc nameloop 1
return